﻿define([
    'Xjs/core/util',
    'Xjs/ui/Control',
// Include the modules that register the types of the components of the tree
    'Xjs/ui/tree/TreeNode'
],
function (util, Control) {
    'use strict';

    var type = 'tree',
    Tree = Xjs.getType(type);

    if (Tree) { // It has been already loaded
        return Tree;
    }

    Tree = util.define({
        base: Control,
        construct: function (conf, parent) {
            Tree.base.constructor.call(this, conf, parent); // Call the base constructor

            this.root = conf.root;
        },
        tag: 'div',
        type: type,
        defaultChildType: 'treeNode'
    });

    Xjs.registerType(Tree);

    return Tree;
});